Repository navigation
Fix late trailers on streaming HTTP responses - #1553
Merged
Merged
Conversation
Signed-off-by: Jerome Louvel <[email protected]> Co-authored-by: Copilot <[email protected]>
|
jlouvel
added a commit
that referenced
this pull request
Oct 20, 2026
Address the failures detected on PR #1553 and on the 3.0 branch: - ChannelOutputStream: writes from a call thread only update the channel writability once the event loop processes them, so a fast producer could queue a whole response body and never notice that the stream was reset (flaky Http2CancellationTestCase). Bound the bytes in flight to the channel high water mark and fail on the first failed write. - NettyServerHandler: end the request body at once for HTTP/1.1 requests without a body. The call could otherwise complete before the empty last content was delivered and close a connection announced as kept alive (flaky RedirectTestCase.stopsAfterMaxRedirects). - NettyServerCall: split writeHead to fix the SonarCloud cognitive complexity issue (java:S3776), without behavior change. Co-authored-by: Copilot <[email protected]>
jlouvel
added a commit
that referenced
this pull request
Oct 21, 2026
Address the failures detected on PR #1553 and on the 3.0 branch: - ChannelOutputStream: writes from a call thread only update the channel writability once the event loop processes them, so a fast producer could queue a whole response body and never notice that the stream was reset (flaky Http2CancellationTestCase). Bound the bytes in flight to the channel high water mark and fail on the first failed write. - NettyServerHandler: end the request body at once for HTTP/1.1 requests without a body. The call could otherwise complete before the empty last content was delivered and close a connection announced as kept alive (flaky RedirectTestCase.stopsAfterMaxRedirects). - NettyServerCall: split writeHead to fix the SonarCloud cognitive complexity issue (java:S3776), without behavior change. Co-authored-by: Copilot <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Summary
Allow HTTP/2 and HTTP/3 streaming responses to publish trailers after the response head and body have started streaming.
The connector now keeps trailer emission enabled for stream-based responses that can carry a body, even when the trailer collection is empty when response headers are written. HTTP/1.1 continues to require trailer names before the response head, and bodyless responses remain unchanged.
Validation
mvnw -q -pl org.restlet '-Dtest=HttpTrailersTestCase,Http2TrailerHeadersTestCase' testmvnw -q -pl org.restlet -Dtest=Http3TestCase#getAndPutOverHttp3 testmvnw -q -pl org.restlet -Dtest=Http3TestCase#exchangesTrailersAddedAfterTheFirstBodyFlushOverHttp3 testmvnw -q -pl org.restlet spotless:checkThe regression tests cover late trailers after a body flush on both HTTP/2 and HTTP/3, plus existing HTTP/1.1/HTTP/2 trailer behavior.